import { IStorage } from './type';
import { MinioStorage } from './minioStorage';
import { ObjectStorage } from './objectStorage';
import {configurationService} from "../configService";
import {OssStorage} from "./ossStorage";
export function initObjectStorageService(options?: IStorage): ObjectStorage {
  if (options) {
    if (options.type === 'minio') {
      return new MinioStorage(options.config);
    } else if (options.type === 'oss') {
      return new OssStorage(options.config);
    }
    throw new Error(`unsupported object storage backend ${options.type}`);
  }
}
export const objectStorageService = initObjectStorageService(configurationService.config.objectStorage);
